<template>
  <div class="page">
    <!-- 区域1 -->
    <div class="section">
      <div class="section-header">
        <h2 class="title">我的待办</h2>
        <span class="text-box">更多 &gt;</span>
      </div>
      <div class="section-body">
        <div class="row" v-for="(item, index) in section1Items" :key="index">
          <div class="row-header">
            <span class="box1">考勤审批</span>
          </div>
          <div class="row-footer">
            <span class="box2">{{ item.text }}</span>
            <img class="icon" src="path/to/right.png" alt="right" />
          </div>
          <div v-if="index < section1Items.length - 1" class="divider"></div>
        </div>
      </div>
    </div>

    <!-- 区域2 -->
    <div class="section">
      <!-- 顶部两个tab按钮 -->
      <div class="tabs">
        <div
          v-for="(tab, index) in tabs"
          :key="index"
          class="tab"
          :class="{ active: selectedTab === index }"
          @click="selectTab(index)"
        >
          {{ tab }}
        </div>
      </div>
      <div class="divider"></div>

      <!-- 5个tab按钮 -->
      <div class="sub-tabs">
        <div
          v-for="(subTab, index) in subTabs"
          :key="index"
          class="sub-tab"
          :class="{ active: selectedSubTab === index }"
          @click="selectSubTab(index)"
        >
          {{ subTab }}
        </div>
      </div>
      <div class="divider"></div>

      <!-- 信息展示部分 -->
      <div class="info-box">
        <!-- 第一行 -->
        <div class="info-row">
          <span class="tag">布线</span>
          <span class="info-text">项目编号：7012193</span>
          <span class="status">筹备中</span>
        </div>
        <div class="divider"></div>
        <!-- 第二行 -->
        <div class="info-details">
          <div class="bold">项目名称</div>
          <div>计划时间</div>
          <div>机房编号</div>
          <div>机房地址</div>
          <div>整包公司</div>
        </div>
        <div class="divider"></div>
        <!-- 第三行 -->
        <div class="actions">
          <img class="icon" src="path/to/phone.png" alt="phone" />
          <span class="bold">售前经理</span>
          <button class="dispatch-btn">派工</button>
          <button class="complete-btn" @click="goTo('jiedan.vue')">结单</button>
        </div>
      </div>
    </div>

    <!-- 区域3 -->
    <div class="footer">
      <div class="footer-btn" @click="goTo('index.vue')">
        <img src="path/to/1.png" alt="首页" />
        <span>首页</span>
      </div>
      <div class="footer-btn" @click="goTo('profile.vue')">
        <img src="path/to/2.png" alt="我的" />
        <span>我的</span>
      </div>
    </div>
  </div>
</template>



<script>
export default {
  name: "GradientPage",
  data() {
    return {
      section1Items: [
        { text: "2024/02/12" },
        { text: "20000/343" },
        { text: "20022200/343" },
      ],
      tabs: ["Tab1", "Tab2"],
      selectedTab: 0,
      subTabs: ["Sub1", "Sub2", "Sub3", "Sub4", "Sub5"],
      selectedSubTab: 0,
    };
  },
  methods: {
    selectTab(index) {
      this.selectedTab = index;
    },
    selectSubTab(index) {
      this.selectedSubTab = index;
    },
    goTo(page) {
      this.$router.push({ path: page });
    },
  },
};
</script>



<style scoped>
/* 页面背景渐变 */
.page {
  width: 100%;
  height: 100vh;
  background: linear-gradient(to right, #f0effd, #ebf9f9);
  padding: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 区域公共样式 */
.section {
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

/* 区域1样式 */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.title {
  font-size: 16px;
  font-weight: bold;
}
.text-box {
  color: #9d9e9f;
}
.row {
  padding: 10px 0;
}
.row-header .box1 {
  background: #98c355;
  border-radius: 8px;
  padding: 5px 10px;
  color: #fff;
}
.row-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.row-footer .box2 {
  color: #9d9e9f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-footer .icon {
  width: 20px;
  height: 20px;
}
.divider {
  height: 1px;
  background: #f4f5f9;
}

/* 区域2样式 */
.tabs {
  display: flex;
  justify-content: flex-start;
}
.tab {
  width: 100px;
  text-align: center;
  font-size: 18px;
  padding: 10px 0;
  cursor: pointer;
}
.tab.active {
  font-weight: bold;
  color: #7e9b4f;
  border-bottom: 2px solid #7e9b4f;
}
.sub-tabs {
  display: flex;
  justify-content: space-between;
}
.sub-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  cursor: pointer;
  background: #f4f5f9;
}
.sub-tab.active {
  background: #f0f6e8;
  color: #7e9b4f;
}
.info-box {
  padding: 10px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tag {
  background: #e49f17;
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 10px;
}
.info-text {
  color: #9d9e9f;
}
.status {
  color: #da4926;
}
.info-details .bold {
  font-weight: bold;
}
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dispatch-btn {
  border: 1px solid #98c355;
  color: #98c355;
}
.complete-btn {
  background: #98c355;
  color: #fff;
}

/* 底部导航 */
.footer {
  background: #fff;
  height: 150px;
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
}
.footer-btn {
  flex: 1;
  text-align: center;
  padding: 10px;
}
.footer-btn img {
  width: 30px;
  height: 30px;
}
.footer-btn span {
  display: block;
  margin-top: 5px;
}
</style>
